/* Vertex3D.h  -- vertex representation 

Copyright (C) 2010 Gabriel Alises Cano, Javier Angulo Lucerón

This file is part of Computer Graphics : Final Project 09-10.

Computer Graphics : Final Project 09-10 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Computer Graphics : Final Project 09-10 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Computer Graphics : Final Project 09-10.  If not, see <http://www.gnu.org/licenses/>. */


#ifndef VERTEX3D_H
#define VERTEX3D_H

#include <GL/gl.h>
#include <list>
#include <iostream>

#include "Types.h"

using namespace std;

class Vertex3D {

 private:
  /** \brief Vertex description
 	 *  x, y and z values */
  GLdouble _position[3];
	/** \brief Vertex normal vector */
  GLdouble _normal[3];
	/** \brief State */
	TState state;
	
 public:
  Vertex3D ();
  Vertex3D (const Vertex3D& v);
  Vertex3D (const GLdouble position[3]);
  ~Vertex3D ();

	/** \brief Vertex comparison */
  bool operator== (const Vertex3D& v);

  GLdouble x () const;
  GLdouble y () const;
  GLdouble z () const;

	/** \return Position of vertex */	
	GLdouble *pos ();

	/** \brief Computes vertex normal
 	 *  \param faces_normals : normals of the adyacent faces */
  void compute_normal ();

	/** \return Vertex normal */
  const GLdouble* normal () const;
	/** \brief Vectorial product
   * \param v2 : second vector
   * \param result : where to store the product */
	void vec3_prod (const Vertex3D& v2, GLdouble *result);


  /** \brief Set the x position */
  void set_x (GLdouble x);
  /** \brief Set the x position */
  void set_y (GLdouble y);
  /** \brief Set the x position */
  void set_z (GLdouble z);
	/** \brief Set state of vertex */		
	void set_state (TState st);
	/** \brief Get state of object 
   * 	\return State of Object */
	TState get_state ();
};

#endif
